package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.CopyrightAuctionDividedLog;
import com.sc.nft.entity.CopyrightAuctionRound;
import com.sc.nft.entity.vo.CopyrightAuctionRoundAdminVO;
import com.sc.nft.entity.vo.CopyrightAuctionRoundUserListVO;
import com.sc.nft.entity.vo.CopyrightAuctionWinListVO;
import com.sc.nft.mapper.CopyrightAuctionDividedLogMapper;
import com.sc.nft.mapper.CopyrightAuctionRoundMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author：LiGen
 * @Package：com.sc.nft.dao
 * @Project：sc_metago
 * @name：CopyrightAuctionDao
 * @Date：2024/9/12 17:39
 * @Filename：CopyrightAuctionDao
 */
@Slf4j
@Repository
public class CopyrightAuctionDividedLogDao extends ServiceImpl<CopyrightAuctionDividedLogMapper, CopyrightAuctionDividedLog> {

    /**
     * 获取平台未分账数据
     * @return
     */
    public List<CopyrightAuctionDividedLog> getPlatFormDividends() {
        LambdaQueryWrapper<CopyrightAuctionDividedLog> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(CopyrightAuctionDividedLog::getUserId,0);
        queryWrapper.eq(CopyrightAuctionDividedLog::getIsHandle,Boolean.FALSE);
        return list(queryWrapper);
    }

    public boolean updateStatusByIdList(List<Long> resultIdList, Boolean isHandler) {
        LambdaUpdateWrapper<CopyrightAuctionDividedLog> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.in(CopyrightAuctionDividedLog::getId,resultIdList);
        updateWrapper.set(CopyrightAuctionDividedLog::getIsHandle,isHandler);
        return update(updateWrapper);
    }
}
